import { baseRequestClient, requestClient } from '#/api/request';

export namespace ArrivalNotice {
  export interface Params {
    attr1: null;
  }
  export interface Row {
    searchValue: null;
    createBy: string;
    createTime: Date;
    updateBy: string;
    updateTime: Date;
    remark: string;
    params: Params;
    noticeId: number;
    noticeCode: string;
    noticeName: string;
    poCode: string;
    vendorId: number;
    vendorCode: string;
    vendorName: string;
    vendorNick: string;
    arrivalDate: Date | string;
    contact: string;
    tel: string;
    status: string;
    attr2: null;
    attr3: number;
    attr4: number;
    attr1: boolean | null | string;
  }
  export interface GetListParams {
    pageNum: number;
    pageSize: number;
    noticeId?: string;
  }
  export interface GetListReturn {
    total: number;
    rows: Row[];
    code: number;
    msg: string;
  }
}

// 获取列表
export const getArrivalNoticeTableList = (
  params: ArrivalNotice.GetListParams,
) =>
  requestClient.get<ArrivalNotice.GetListReturn>('/mes/wm/arrivalnotice/list', {
    params,
  });
// 增加到货通知
export const addArrivalNotice = (data: ArrivalNotice.Row) =>
  requestClient.post<ArrivalNotice.GetListReturn>(
    '/mes/wm/arrivalnotice',
    data,
  );

// 删除到货通知
export const deleteArrivalNotice = (id: string) =>
  requestClient.delete<ArrivalNotice.GetListReturn>(
    `/mes/wm/arrivalnotice/${id}`,
  );

// 修改到货通知
export const updateArrivalNotice = (data: ArrivalNotice.Row) =>
  requestClient.put<ArrivalNotice.GetListReturn>('/mes/wm/arrivalnotice', data);

export const getArrivalNoticeCode = () =>
  baseRequestClient.get<any>('/system/autocode/get/ARRIVALNOTICE_CODE');
